<template>
  <div>
    <h2>学生姓名{{name}} </h2>
    <h2>学生年龄 {{age}}</h2>
    <button @click="show">触发app事件</button>
    <button @click="unbind">解除app事件绑定</button>
  </div>
</template>

<script>
export default {
  name: "Student",
  data(){
    return {
      name:'张三',age:12
    }
  },
  methods:{
    show(){
      this.$emit("showstu",this.name)
    },
    unbind(){
      this.$off("showstu")
    }
  }
}
</script>

<style scoped>

</style>
